import {
    Action
} from 'redux';

const initState = {
    notification: {}
}

import * as types from './../types/setting';

export default (state = initState, action: Action) => {
    const {
        type,
        data
    } = action;
    switch (type) {
        case types.getNotifyStatus: {
            state.notification = data;
            return {
                ...state
            }
        }

        case types.setNotifyStatus: {
            const {
                type,
                status
            } = data;

            const {
                notification = {}
            } = state;

            notification[type] = status;

            return {
                ...state,
                notification:notification
            }
        }
    }

    return state;
}